﻿@{
    var user = (V5_Model.ModelGZUser)Session["isLogin"];
    System.Data.DataTable dt = V5.GZProduct.Query_By("*", " and DirectMarketing=1", " CreateDate desc", 0);

    int count = 0;

    bool isLogin = false;

    if (user != null)
    {
        isLogin = true;
    }

    if (dt != null && dt.Rows.Count > 0)
    {
        count = dt.Rows.Count;
    } 
    
}
<div id="hotcontainer" class="hotSaleRecommend" style="margin-top: 10px">
    <h2>
        热卖推荐</h2>
    @if (count == 0)
    {
        <div>
            暂无数据</div> 
    }
    else
    {
        var i=1;
        foreach (System.Data.DataRow item in dt.Rows)
        {
            if (i == 4) { break; }
        <dl>
            <dt><a href="@V5.Url.Action("Product/View", new { ID = item["ID"].ToString() })" target="_blank"
                             title="@item["ProductName"]">@item["ProductName"]</a> </dt>
            <dd class="pic">
                <a href="@V5.Url.Action("Product/View", new { ID = item["ID"].ToString() })" target="_blank">
                    <img src="/@item["PicturePath"]" title="@item["ProductName"]">
                </a>
            </dd>
           <dd class="price">
                <span>今日特价：</span><strong>￥@(isLogin ? item["MaxSalePrice"].ToString() : "登陆后查看")</strong>
            </dd>
             <dd class="buy">
                <a href="@V5.Url.Action("Product/View", new { ID = item["ID"].ToString() })" target="_blank" >
                    立即抢购 </a>
            </dd>
        </dl>
            i++;
        }
    }
    <sup class="hotSup">热卖推荐</sup>
</div>
